package com.wanxi.model;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * 新闻
 * @author Chengbo Zhang
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "news")
public class News {
    @JsonSerialize(using = ToStringSerializer.class)
    @Id
    private Long id;
    @Field(analyzer = "ik_max_word",type = FieldType.Text,name = "title")
    private String title;
    @Field(analyzer = "ik_max_word",type = FieldType.Text,name = "content")
    private String content;
    private Date date;
    private Integer enable;
    private Date createTime;
    private Date updateTime;
    private String remark;

    private NewsType newsType;
}
